package com.lubase.metadata.service.impl;

import com.lubase.metadata.mapper.MysqlMetadataReadMapper;
import com.lubase.metadata.model.ColumnMetaModel;
import com.lubase.metadata.model.ConstraintMetaModel;
import com.lubase.metadata.model.TableMetaModel;
import com.lubase.metadata.service.SpecificMetadataReadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SpecificMetadataReadServiceOfMysql implements SpecificMetadataReadService {
    @Autowired
    MysqlMetadataReadMapper mysqlMetadataReadMapper;

    @Override
    public String databaseType() {
        return "mysql";
    }

    @Override
    public List<TableMetaModel> getTableList(String databaseCode) {
        return mysqlMetadataReadMapper.getTableList(databaseCode);
    }

    @Override
    public List<ColumnMetaModel> getTableColumnListByDatabase(String databaseCode) {
        return mysqlMetadataReadMapper.getTableColumnListByDatabase(databaseCode);
    }

    @Override
    public List<ConstraintMetaModel> getTableConstraintList(String databaseCode) {
        return mysqlMetadataReadMapper.getTableConstraintList(databaseCode);
    }
}
